{{ define "content" }}
<script type="application/javascript">
    function valueFormat(n) {
        return new Intl.NumberFormat().format(n);
    }
</script>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <div class="x_content">
                <div role="tabpanel">
                    <ul class="nav nav-tabs bar_tabs" role="tablist">
                        <li role="presentation"{{ if eq .action "" }} class="active"{{ end }}><a href="{{ if eq .action "" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}{{ end }}">{{ i18n "Current measurements" . }}</a></li>
                        <li role="presentation"{{ if eq .action "monthly" }} class="active"{{ end }}><a href="{{ if eq .action "monthly" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}?action=monthly&all=1{{ end }}">{{ i18n "Monthly statistics" . }}</a></li>
                        <li role="presentation"{{ if eq .action "display" }} class="active"{{ end }}><a href="{{ if eq .action "display" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}?action=display{{ end }}">{{ i18n "Display" . }}</a></li>
                        <li role="presentation"{{ if eq .action "events-on-off" }} class="active"{{ end }}><a href="{{ if eq .action "events-on-off" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}?action=events-on-off{{ end }}">{{ i18n "Events on/off" . }}</a></li>
                        <li role="presentation"{{ if eq .action "events-open-close" }} class="active"{{ end }}><a href="{{ if eq .action "events-open-close" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}?action=events-open-close{{ end }}">{{ i18n "Events open/close" . }}</a></li>
                        <li role="presentation"{{ if eq .action "holidays" }} class="active"{{ end }}><a href="{{ if eq .action "holidays" }}javascript:void(0);{{ else }}{{ .Request.URL.Path }}?action=holidays{{ end }}">{{ i18n "Holidays" . }}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane fade active in">
                            {{ if eq .action "monthly" }}
                                <p class="text-muted font-13 m-b-30">
                                    {{ raw (i18n "Current date time on device %s" . nil nil nil (print "<script type=\"application/javascript\">document.write(dateToString('" (.date.Format "2006-01-02T15:04:05-07:00") "'))</script>")) }}
                                </p>

                                <table class="table table-striped datatable dt-responsive nowrap" style="width:100%">
                                    <thead>
                                    <tr>
                                        <th>{{ i18n "Month" . }}</th>
                                        {{ if gt $.tariff_count 0 }}<th>{{ i18n "T1 / Wh" . }}</th>{{ end }}
                                        {{ if gt $.tariff_count 1 }}<th>{{ i18n "T2 / Wh" . }}</th>{{ end }}
                                        {{ if gt $.tariff_count 2 }}<th>{{ i18n "T3 / Wh" . }}</th>{{ end }}
                                        {{ if gt $.tariff_count 3 }}<th>{{ i18n "T4 / Wh" . }}</th>{{ end }}
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {{ range $i, $stats := .stats }}
                                    <tr{{ if and (eq $stats.Month $.date.Month) (eq $stats.Year $.date.Year) }} class="success"{{ end }}>
                                        <td>{{ i18n $stats.Month.String $ nil "dashboard" }} {{ $stats.Year }}</td>
                                        {{ if gt $.tariff_count 0 }}
                                        <td>
                                            <script type="application/javascript">document.write(valueFormat({{ $stats.Values.Tariff1 }}))</script>
                                            {{ if gt $stats.T1Trend 0 }}
                                                <span class="label label-danger"><script type="application/javascript">document.write(valueFormat({{ $stats.T1Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T1Trend }}))</script></span>
                                            {{ else if lt $stats.T1Trend 0 }}
                                                <span class="label label-success"><script type="application/javascript">document.write(valueFormat({{ $stats.T1Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T1Trend }}))</script></span>
                                            {{ else if eq $stats.T1Trend 0 }}
                                                <span class="label label-info"><script type="application/javascript">document.write(valueFormat({{ $stats.T1Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T1Trend }}))</script></span>
                                            {{ else if gt $stats.T1Delta 0 }}
                                                <span class="label label-default"><script type="application/javascript">document.write(valueFormat({{ $stats.T1Delta }}))</script></span>
                                            {{ end }}
                                        </td>
                                        {{ end }}
                                        {{ if gt $.tariff_count 1 }}
                                        <td>
                                            <script type="application/javascript">document.write(valueFormat({{ $stats.Values.Tariff2 }}))</script>
                                            {{ if gt $stats.T2Trend 0 }}
                                                <span class="label label-danger"><script type="application/javascript">document.write(valueFormat({{ $stats.T2Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T2Trend }}))</script></span>
                                            {{ else if lt $stats.T2Trend 0 }}
                                                <span class="label label-success"><script type="application/javascript">document.write(valueFormat({{ $stats.T2Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T2Trend }}))</script></span>
                                            {{ else if eq $stats.T2Trend 0 }}
                                                <span class="label label-info"><script type="application/javascript">document.write(valueFormat({{ $stats.T2Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T2Trend }}))</script></span>
                                            {{ else if gt $stats.T2Delta 0 }}
                                                <span class="label label-default"><script type="application/javascript">document.write(valueFormat({{ $stats.T2Delta }}))</script></span>
                                            {{ end }}
                                        </td>
                                        {{ end }}
                                        {{ if gt $.tariff_count 2 }}
                                        <td>
                                            <script type="application/javascript">document.write(valueFormat({{ $stats.Values.Tariff3 }}))</script>
                                            {{ if gt $stats.T3Trend 0 }}
                                                <span class="label label-danger"><script type="application/javascript">document.write(valueFormat({{ $stats.T3Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T3Trend }}))</script></span>
                                            {{ else if lt $stats.T3Trend 0 }}
                                                <span class="label label-success"><script type="application/javascript">document.write(valueFormat({{ $stats.T3Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T3Trend }}))</script></span>
                                            {{ else if eq $stats.T3Trend 0 }}
                                                <span class="label label-info"><script type="application/javascript">document.write(valueFormat({{ $stats.T3Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T3Trend }}))</script></span>
                                            {{ else if gt $stats.T3Delta 0 }}
                                                <span class="label label-default"><script type="application/javascript">document.write(valueFormat({{ $stats.T3Delta }}))</script></span>
                                            {{ end }}
                                        </td>
                                        {{ end }}
                                        {{ if gt $.tariff_count 3 }}
                                        <td>
                                            <script type="application/javascript">document.write(valueFormat({{ $stats.Values.Tariff4 }}))</script>
                                            {{ if gt $stats.T4Trend 0 }}
                                                <span class="label label-danger"><script type="application/javascript">document.write(valueFormat({{ $stats.T4Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T4Trend }}))</script></span>
                                            {{ else if lt $stats.T4Trend 0 }}
                                                <span class="label label-success"><script type="application/javascript">document.write(valueFormat({{ $stats.T4Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T4Trend }}))</script></span>
                                            {{ else if eq $stats.T4Trend 0 }}
                                                <span class="label label-info"><script type="application/javascript">document.write(valueFormat({{ $stats.T4Delta }}))</script> / <script type="application/javascript">document.write(valueFormat({{ $stats.T4Trend }}))</script></span>
                                            {{ else if gt $stats.T4Delta 0 }}
                                                <span class="label label-default"><script type="application/javascript">document.write(valueFormat({{ $stats.T4Delta }}))</script></span>
                                            {{ end }}
                                        </td>
                                        {{ end }}
                                    </tr>
                                    {{ end }}
                                    </tbody>
                                </table>
                            {{ else if eq .action "events-on-off" }}
                            <table class="table table-striped datatable dt-responsive nowrap" style="width:100%">
                                <thead>
                                    <tr>
                                        <th>{{ i18n "Date" . }}</th>
                                        <th>{{ i18n "State" . }}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {{ range $i, $event := .events }}
                                    <tr>
                                        <td><script type="application/javascript">document.write(dateToString('{{ $event.Time.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                        <td>{{ if $event.State }}{{ i18n "on" $ }}{{ else }}{{ i18n "off" $ }}{{ end }}</td>
                                    </tr>
                                    {{ end }}
                                </tbody>
                            </table>
                            {{ else if eq .action "events-open-close" }}
                            <table class="table table-striped datatable dt-responsive nowrap" style="width:100%">
                                <thead>
                                    <tr>
                                        <th>{{ i18n "Date" . }}</th>
                                        <th>{{ i18n "State" . }}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {{ range $i, $event := .events }}
                                    <tr>
                                        <td><script type="application/javascript">document.write(dateToString('{{ $event.Time.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                        <td>{{ if $event.State }}{{ i18n "open" $ }}{{ else }}{{ i18n "close" $ }}{{ end }}</td>
                                    </tr>
                                    {{ end }}
                                </tbody>
                            </table>
                            {{ else if eq .action "display" }}
                                <form id="display" class="form-horizontal form-label-left" data-toggle="validator" method="post">
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_t1">
                                            {{ i18n "Show T1" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_t1" id="mode_t1" {{ if eq (print .mode.IsTariff1) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_t2">
                                            {{ i18n "Show T2" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_t2" id="mode_t2" {{ if eq (print .mode.IsTariff2) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_t3">
                                            {{ i18n "Show T3" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_t3" id="mode_t3" {{ if eq (print .mode.IsTariff3) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_t4">
                                            {{ i18n "Show T4" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_t4" id="mode_t4" {{ if eq (print .mode.IsTariff4) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_amount">
                                            {{ i18n "Show amount" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_amount" id="mode_amount" {{ if eq (print .mode.IsAmount) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_power">
                                            {{ i18n "Show power" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_power" id="mode_power" {{ if eq (print .mode.IsPower) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_time">
                                            {{ i18n "Show time" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_time" id="mode_time" {{ if eq (print .mode.IsTime) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="mode_date">
                                            {{ i18n "Show date" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="checkbox" class="js-switch" name="mode_date" id="mode_date" {{ if eq (print .mode.IsDate) "true" }} checked{{ end }} />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="time_t1">
                                            {{ i18n "Interval for not current tariff" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="number" name="time_t1" id="time_t1" value="{{ .time.Tariff1 }}" pattern="^[-+]?[0-9]*$"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="time_t2">
                                            {{ i18n "Interval for current tariff" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="number" name="time_t2" id="time_t2" value="{{ .time.Tariff2 }}" pattern="^[-+]?[0-9]*$"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="time_t3">
                                            {{ i18n "Interval for power, time and date" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="number" name="time_t3" id="time_t3" value="{{ .time.Tariff3 }}" pattern="^[-+]?[0-9]*$"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="time_t4">
                                            {{ i18n "Interval for after press back button" . }} <span class="required">*</span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="number" name="time_t4" id="time_t4" value="{{ .time.Tariff4 }}" pattern="^[-+]?[0-9]*$"/>
                                        </div>
                                    </div>

                                    <div class="ln_solid"></div>
                                    <div class="form-group">
                                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                            <button type="reset" class="btn btn-info" value="reset">{{ i18n "Reset" . }}</button>
                                            <button type="submit" class="btn btn-success" value="save">{{ i18n "Save" . }}</button>
                                        </div>
                                    </div>
                                </form>
                            {{ else if eq .action "holidays" }}
                                <table class="table table-striped datatable dt-responsive nowrap" style="width:100%">
                                    <thead>
                                    <tr>
                                        <th>{{ i18n "Day" . }}</th>
                                        <th>{{ i18n "Month" . }}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        {{ range $i, $day := .holidays }}
                                        <tr>
                                            <td>{{ $day.Format "2" }}</td>
                                            <td>{{ i18n $day.Month.String $ nil "dashboard" }}</td>
                                        </tr>
                                        {{ end }}
                                    </tbody>
                                </table>
                            {{ else }}
                                <table class="table table-striped datatable dt-responsive nowrap" style="width:100%">
                                    <thead>
                                    <tr>
                                        <th class="md-col-2">{{ i18n "Measurement" . }}</th>
                                        <th class="md-col-2">{{ i18n "Value" . }}</th>
                                        <th>{{ i18n "Description" . }}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>{{ i18n "Date and time" . }}</td>
                                            {{ if .datetime.error }}
                                                <td class="text-danger">{{ .datetime.error.Error }}</td>
                                            {{ else }}
                                                <td>
                                                    <script type="application/javascript">document.write(dateToString('{{ .datetime.value.Format "2006-01-02T15:04:05-07:00" }}'))</script>
                                                    {{ if ne .datetime.delta 0 }}
                                                        <strong class="text-danger">
                                                        {{ if gt .datetime.delta 0 }}
                                                            {{ i18nPlural "+%d second" "+%d seconds" .datetime.delta $ nil nil nil .datetime.delta }}
                                                        {{ else }}
                                                            {{ i18nPlural "%d second" "%d seconds" .datetime.delta $ nil nil nil .datetime.delta }}
                                                        {{ end }}
                                                        </strong>
                                                    {{ end }}
                                                </td>
                                            {{ end }}
                                            <td>{{ i18n "Current date and time on meter" . }}</td>
                                        </tr>
                                        {{ if .param_last_change_data }}
                                        <tr>
                                            <td>{{ i18n "Param last change" . }}</td>
                                            {{ if .param_last_change_data.error }}
                                                <td class="text-danger">{{ .param_last_change_data.error.Error }}</td>
                                            {{ else }}
                                                <td><script type="application/javascript">document.write(dateToString('{{ .param_last_change_data.value.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td>{{ i18n "Param last change date" . }}</td>
                                        </tr>
                                        {{ end }}
                                        <tr>
                                            <td>{{ i18n "Make date" . }}</td>
                                            {{ if .make_date.error }}
                                                <td class="text-danger">{{ .make_date.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ .make_date.value.Format "2006-01-02" }}</td>
                                            {{ end }}
                                            <td>{{ i18n "Make date" . }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ i18n "Last power off" . }}</td>
                                            {{ if .last_power_off_datetime.error }}
                                                <td class="text-danger">{{ .last_power_off_datetime.error.Error }}</td>
                                            {{ else }}
                                                <td><script type="application/javascript">document.write(dateToString('{{ .last_power_off_datetime.value.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>{{ i18n "Last power on" . }}</td>
                                            {{ if .last_power_on_datetime.error }}
                                                <td class="text-danger">{{ .last_power_on_datetime.error.Error }}</td>
                                            {{ else }}
                                                <td><script type="application/javascript">document.write(dateToString('{{ .last_power_on_datetime.value.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>{{ i18n "Last close cap" . }}</td>
                                            {{ if .last_close_cap_datetime.error }}
                                                <td class="text-danger">{{ .last_close_cap_datetime.error.Error }}</td>
                                            {{ else }}
                                                <td><script type="application/javascript">document.write(dateToString('{{ .last_close_cap_datetime.value.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>{{ i18n "Voltage" . }}</td>
                                            {{ if .voltage.error }}
                                                <td class="text-danger">{{ .voltage.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d V" . nil nil nil .voltage.value }}</td>
                                            {{ end }}
                                            <td>{{ i18n "Current voltage" . }}</td>
                                        </tr>
                                        {{ if .voltage_max }}
                                        <tr>
                                            <td>{{ i18n "Voltage maximum can't reset" . }}</td>
                                            {{ if .voltage_max.error }}
                                                <td class="text-danger">{{ .voltage_max.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d V" . nil nil nil .voltage_max.value }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .voltage_max.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        {{ if .voltage_max_reset }}
                                        <tr>
                                            <td>{{ i18n "Voltage maximum can reset" . }}</td>
                                            {{ if .voltage_max_reset.error }}
                                                <td class="text-danger">{{ .voltage_max_reset.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d V" . nil nil nil .voltage_max_reset.value }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .voltage_max_reset.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        <tr>
                                            <td>{{ i18n "Amperage" . }}</td>
                                            {{ if .amperage.error }}
                                                <td class="text-danger">{{ .amperage.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%.2f A" . nil nil nil .amperage.value }}</td>
                                            {{ end }}
                                            <td>{{ i18n "Current amperage" . }}</td>
                                        </tr>
                                        {{ if .amperage_max }}
                                        <tr>
                                            <td>{{ i18n "Amperage maximum can't reset" . }}</td>
                                            {{ if .amperage_max.error }}
                                                <td class="text-danger">{{ .amperage_max.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%.2f A" . nil nil nil .amperage_max.value  }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .amperage_max.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        {{ if .amperage_max_reset }}
                                        <tr>
                                            <td>{{ i18n "Amperage maximum can reset" . }}</td>
                                            {{ if .amperage_max_reset.error }}
                                                <td class="text-danger">{{ .amperage_max_reset.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%.2f A" . nil nil nil .amperage_max_reset.value }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .amperage_max_reset.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        <tr>
                                            <td>{{ i18n "Power" . }}</td>
                                            {{ if .power.error }}
                                                <td class="text-danger">{{ .power.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d W" . nil nil nil .power.value }}</td>
                                            {{ end }}
                                            <td>{{ i18n "Current power" . }}</td>
                                        </tr>
                                        {{ if .power_max }}
                                        <tr>
                                            <td>{{ i18n "Power maximum can't reset" . }}</td>
                                            {{ if .power_max.error }}
                                                <td class="text-danger">{{ .power_max.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d W" . nil nil nil .power_max.value }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .power_max.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        {{ if .power_max_reset }}
                                        <tr>
                                            <td>{{ i18n "Power maximum can reset" . }}</td>
                                            {{ if .power_max_reset.error }}
                                                <td class="text-danger">{{ .power_max_reset.error.Error }}</td>
                                            {{ else }}
                                                <td>{{ i18n "%d W" . nil nil nil .power_max_reset.value }} {{ i18n "at" . }} <script type="application/javascript">document.write(dateToString('{{ .power_max_reset.date.Format "2006-01-02T15:04:05-07:00" }}'))</script></td>
                                            {{ end }}
                                            <td></td>
                                        </tr>
                                        {{ end }}
                                        <tr>
                                            <td>{{ i18n "Two sensors" . }}</td>
                                                {{ if .model_two_sensors.error }}
                                                    <td class="text-danger">{{ .model_two_sensors.error.Error }}</td>
                                                {{ else }}
                                                    <td>{{ if .model_two_sensors.value }}{{ i18n "yes" . }}{{ else }}{{ i18n "no" . }}{{ end }}</td>
                                                {{ end }}
                                            <td>{{ i18n "Two current sensors" . }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ i18n "Relay" . }}</td>
                                                {{ if .model_relay.error }}
                                                    <td class="text-danger">{{ .model_relay.error.Error }}</td>
                                                {{ else }}
                                                    <td>{{ if .model_relay.value }}{{ i18n "yes" . }}{{ else }}{{ i18n "no" . }}{{ end }}</td>
                                                {{ end }}
                                            <td>{{ i18n "Inner relay" . }}</td>
                                        </tr>
                                    </tbody>
                                </table>
                            {{ end }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{{ end }}
